home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / DialogBoxEditor.cpp < prev    next >
Text File  |  1997-02-20  |  4KB  |  132 lines

  1. /*
  2.  *  File:       DialogBoxEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TDialogBox.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->    12/24/96    JDJ        Created
  12.  */
  13.  
  14. #include "DialogBoxEditor.h"
  15.  
  16. #include <ZTextBox.h>
  17.  
  18.  
  19. // ===================================================================================
  20. //    class CEditDialogBoxCommand
  21. // ===================================================================================
  22.  
  23. //---------------------------------------------------------------
  24. //
  25. // CEditDialogBoxCommand::~CEditDialogBoxCommand
  26. //
  27. //---------------------------------------------------------------
  28. CEditDialogBoxCommand::~CEditDialogBoxCommand()
  29. {
  30. }
  31.  
  32.  
  33. //---------------------------------------------------------------
  34. //
  35. // CEditDialogBoxCommand::CEditDialogBoxCommand
  36. //
  37. //---------------------------------------------------------------
  38. CEditDialogBoxCommand::CEditDialogBoxCommand(TDialogBox* pane, const SDialogBoxInfo& oldInfo, const SDialogBoxInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  39. {
  40. }
  41.  
  42.  
  43. //---------------------------------------------------------------
  44. //
  45. // CEditDialogBoxCommand::UpdatePane
  46. //
  47. //---------------------------------------------------------------
  48. void CEditDialogBoxCommand::UpdatePane(const SDialogBoxInfo& info)
  49. {
  50.     mPane->SetDefaultButton(info.defaultName);
  51.     mPane->SetCancelButton(info.cancelName);
  52. }
  53.  
  54. #pragma mark -
  55.  
  56. // ===================================================================================
  57. //    CDialogBoxEditor
  58. // ===================================================================================
  59.  
  60. static TReanimatorRegister<CDialogBoxEditor> sDialogBoxEditorRegistrar;
  61.  
  62. //---------------------------------------------------------------
  63. //
  64. // CDialogBoxEditor::~CDialogBoxEditor
  65. //
  66. //---------------------------------------------------------------
  67. CDialogBoxEditor::~CDialogBoxEditor()
  68. {
  69. }
  70.  
  71.  
  72. //---------------------------------------------------------------
  73. //
  74. // CDialogBoxEditor::CDialogBoxEditor
  75. //
  76. //---------------------------------------------------------------
  77. CDialogBoxEditor::CDialogBoxEditor(TView* superView) : Inherited(superView)
  78. {
  79. }
  80.  
  81.  
  82. //---------------------------------------------------------------
  83. //
  84. // CDialogBoxEditor::Create                                [static]
  85. //
  86. //---------------------------------------------------------------
  87. MReanimatable* CDialogBoxEditor::Create(MReanimatable* parent)
  88. {
  89.     return new CDialogBoxEditor(dynamic_cast<TView*>(parent));
  90. }
  91.  
  92.  
  93. //---------------------------------------------------------------
  94. //
  95. // CDialogBoxEditor::GetEditorInfo        
  96. //
  97. //---------------------------------------------------------------
  98. SDialogBoxInfo CDialogBoxEditor::GetEditorInfo() const
  99. {
  100.     SDialogBoxInfo info;
  101.     
  102.     TTextBox* textBox = nil;
  103.         
  104.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Default Name"));
  105.     info.defaultName = textBox->GetText();
  106.     
  107.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Cancel Name"));
  108.     info.cancelName = textBox->GetText();
  109.     
  110.     return info;
  111. }
  112.  
  113.  
  114. //---------------------------------------------------------------
  115. //
  116. // CDialogBoxEditor::SetEditorInfo
  117. //
  118. //---------------------------------------------------------------
  119. void CDialogBoxEditor::SetEditorInfo(const SDialogBoxInfo& info)
  120. {
  121.     TTextBox* textBox = nil;
  122.         
  123.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Default Name"));
  124.     textBox->SetText(info.defaultName);
  125.     
  126.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Cancel Name"));
  127.     textBox->SetText(info.cancelName);
  128. }
  129.  
  130.  
  131.  
  132.